<?php

namespace Cuke\Models;

class CukeConnector extends ModelBase
{

    /**
     *
     * @var integer
     * @Primary
     * @Identity
     * @Column(type="integer", length=11, nullable=false)
     */
    public $connector_id;

    /**
     *
     * @var integer
     * @Column(type="integer", length=11, nullable=false)
     */
    public $user_id;

    /**
     *
     * @var string
     * @Column(type="string", length=100, nullable=false)
     */
    public $group_code;

    /**
     *
     * @var string
     * @Column(type="string", length=200, nullable=false)
     */
    public $connector_name;

    /**
     *
     * @var string
     * @Column(type="string", length=200, nullable=false)
     */
    public $connector_code;

    /**
     *
     * @var string
     * @Column(type="string", length=500, nullable=true)
     */
    public $description;

    /**
     *
     * @var string
     * @Column(type="string", length=200, nullable=false)
     */
    public $protocol;

    /**
     *
     * @var string
     * @Column(type="string", length=500, nullable=false)
     */
    public $request_path;

    /**
     *
     * @var string
     * @Column(type="string", length=20, nullable=false)
     */
    public $request_http_method;

    /**
     *
     * @var string
     * @Column(type="string", length=200, nullable=false)
     */
    public $service_address;

    /**
     *
     * @var integer
     * @Column(type="integer", length=11, nullable=false)
     */
    public $service_timeout;

    /**
     *
     * @var string
     * @Column(type="string", length=20, nullable=false)
     */
    public $result_type;

    /**
     *
     * @var string
     * @Column(type="string", length=50, nullable=false)
     */
    public $authenticate;
    /**
     *
     * @var string
     * @Column(type="string", length=500, nullable=true)
     */
    public $document_url;

    /**
     *
     * @var string
     * @Column(type="string", nullable=false)
     */
    public $create_at;

    /**
     *
     * @var string
     * @Column(type="string", nullable=true)
     */
    public $update_at;
    /**
     *
     * @var string
     * @Column(type="string", nullable=true)
     */
    public $request_mode;
    /**
     *
     * @var integer
     * @Column(type="integer", length=11, nullable=true)
     */
    public $update_id;
    /**
     *
     * @var integer
     * @Column(type="integer", length=4, nullable=false)
     */
    public $status;
    /**
     * Initialize method for model.
     */
    public function initialize()
    {
        $this->setSource("cuke_connector");
    }

    /**
     * Returns table name mapped in the model.
     *
     * @return string
     */
    public function getSource()
    {
        return 'cuke_connector';
    }

    public function beforeUpdate()
    {
        $this->update_at = date('Y-m-d H:i:s');
    }

    /**
     * Allows to query a set of records that match the specified conditions
     *
     * @param mixed $parameters
     * @return CukeConnector[]|CukeConnector|\Phalcon\Mvc\Model\ResultSetInterface
     */
    public static function find($parameters = null)
    {
        return parent::find($parameters);
    }

    /**
     * Allows to query the first record that match the specified conditions
     *
     * @param mixed $parameters
     * @return CukeConnector|\Phalcon\Mvc\Model\ResultInterface
     */
    public static function findFirst($parameters = null)
    {
        return parent::findFirst($parameters);
    }

}
